<?php
    use User\Model\QuestionnaireModel;
?>
<style>
    .finish{height:40px;float:right;padding-top:10px;margin-left:10px;margin-top:-5px}
    .next-step{height:40px;float:right;padding-top:10px;margin-left:30px;margin-top:-5px}
    .end-setting{color:blue;float:right;font-weight: bold}
    .edit-question{color:black;float:right;font-weight: bold}

    .end-upload{position:absolute;margin-left:150px;margin-top:70px}
    .end-span{background-color: #D7D7D7;border: 0}

    .end-h4{margin-left:20px;font-weight:bold;color:black}
    .end-a-first{color:#0099FF;margin-left:20px;font-weight: bold;text-decoration: none}
    .end-a-first:hover{color:#0099FF;text-decoration: none}
    .end-a-first:link{color:#0099FF;text-decoration: none}
    .end-a{color:#0099FF;margin-left:60px;font-weight: bold;text-decoration: none}
    .end-a:hover{color:#0099FF;text-decoration: none}
    .end-a:link{color:#0099FF;text-decoration: none}
    .end-button{margin-left:10px}
    .end-textarea{width:700px;}
    .end-add{margin-bottom:40px}
    .end-text{width:80px;border:1px solid #ccc;border-radius:4px;margin:0 10px;padding:6px 12px;height:34px;font-size:14px}

    .modal-body{padding-bottom:0px}
    .modal-footer{text-align: center}
    .activity-image{position:absolute;left:150px;top:70px}

</style>
<div id="page-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header">
                <span>结束页设置</span>
                <a href="javascript:;" onclick="return statusQuestionnaire({$questionnaire['id']}, 'active');" class="btn btn-default finish">&nbsp;发布&nbsp;</a>
                <a href="{:U('User/Questionnaire/question', array('id' => $questionnaire['id']))}" class="btn btn-default next-step">&nbsp;上一步&nbsp;</a>
                <span class="end-setting">&nbsp;结束页设置</span>
                <span class="edit-question">创建题目&nbsp;></span>
            </h3>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <ul class="nav nav-tabs" id="myTab">
                        <li class="active"><a href="#ending1">结束页</a></li>
                        <li><a href="#ending2">结束语</a></li>
                    </ul>
                </div>
                <div class="panel-body">
                    <form role="form" class="form-horizontal" action="{:U('User/Questionnaire/endingUpdate')}" method="post" enctype="multipart/form-data">
                        <input type="hidden" name="questionnaire_id" value="{$questionnaire['id']}">
                        <div class="tab-content">
                            <div class="tab-pane active" id="ending1">
                                <div class="form-group">
                                    <label class="col-lg-2 col-sm-2 control-label">再玩一次</label>
                                    <div class="col-lg-6">
                                        <input type="hidden" name="ending_play" value="{$questionnaire['ending_play']}">
                                        <input type="file" onchange="uploadImage(this, ['png'], [230, 100], 200, true, true);" class="end-upload" accept="image/gif,image/jpeg,image/jpg,image/png">
                                        <empty name="questionnaire.ending_play">
                                            <img src="/Public/images/questionnaire/ending_play.jpg" class="thumbnail" width="100" height="100">
                                        <else/>
                                            <img src="{$questionnaire['ending_play']}" class="thumbnail" width="100" height="100">
                                        </empty>
                                        <p class="help-block">有默认的按钮图片，可自定义替换，图片为230px*100px的png格式图片，大小不超过200k</p>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 col-sm-2 control-label">分享</label>
                                    <div class="col-lg-6">
                                        <input type="hidden" name="ending_share" value="{$questionnaire['ending_share']}">
                                        <input type="file" onchange="uploadImage(this, ['png'], [230, 100], 200, true, true);" class="end-upload" accept="image/gif,image/jpeg,image/jpg,image/png">
                                        <empty name="questionnaire.ending_share">
                                            <img src="/Public/images/questionnaire/ending_share.jpg" class="thumbnail" width="100" height="100">
                                        <else/>
                                            <img src="{$questionnaire['ending_share']}" class="thumbnail" width="100" height="100">
                                        </empty>
                                        <p class="help-block">有默认的按钮图片，可自定义替换，图片为230px*100px的png格式图片，大小不超过200k</p>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 col-sm-2 control-label">背景图</label>
                                    <div class="col-lg-6">
                                        <input type="hidden" name="ending_background" value="{$questionnaire['ending_background']}">
                                        <input type="file" onchange="uploadImage(this, ['png','jpg','jpeg','bmp','gif'], [750, 1206], 500, true, true);" class="end-upload" accept="image/gif,image/jpeg,image/jpg,image/png">
                                        <empty name="questionnaire.ending_background">
                                            <img src="/Public/images/questionnaire/ending_background.jpg" class="thumbnail" width="100" height="100">
                                        <else/>
                                            <img src="{$questionnaire['ending_background']}" class="thumbnail" width="100" height="100">
                                        </empty>
                                        <p class="help-block">图片为750*1206的png、jpg、jpeg、bmp、gif格式的图片，大小不超过500k</p>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-lg-2 col-sm-2 control-label">外链</label>
                                    <div class="col-lg-6"  style="background-color:#D7D7D7;padding:10px 10px">
                                        <input type="hidden" name="ending_jump" value="{$questionnaire['ending_jump']}">
                                        <input type="file" onchange="uploadImage(this, ['png','jpg','jpeg','bmp','gif'], [600, 200], 200, true, true);" class="end-upload" accept="image/gif,image/jpeg,image/jpg,image/png">
                                        <empty name="questionnaire.ending_jump">
                                            <img src="/Public/images/questionnaire/theme1_follow.png" class="thumbnail" width="100" height="100">
                                        <else/>
                                            <img src="{$questionnaire['ending_jump']}" class="thumbnail" width="100" height="100">
                                        </empty>
                                        <p class="help-block">图片尺寸为宽度小于600px,高度小于200px的png、jpg、jpeg、bmp、gif格式的图片,大小不超过200k</p>
                                        <label class="radio-inline">
                                            <input type="radio" name="has_qrcode" onclick="$('.div1').hide();$('.div2').show();" <if condition="$questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_ON">checked="checked"</if> value="<?php echo QuestionnaireModel::QRCODE_ON; ?>">使用关注二维码
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="has_qrcode" onclick="$('.div1').show();$('.div2').hide();" <if condition="$questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_OFF">checked="checked"</if> value="<?php echo QuestionnaireModel::QRCODE_OFF; ?>">使用跳转链接
                                        </label>
                                        <label class="radio-inline">
                                            <input type="radio" name="has_qrcode" onclick="$('.div1').hide();$('.div2').hide();" <if condition="$questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_MISS">checked="checked"</if> value="<?php echo QuestionnaireModel::QRCODE_MISS; ?>">不显示
                                        </label>
                                        <br/><br/>
                                        <div class="div1" <if condition="($questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_ON) or ($questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_MISS)">style="display:none"</if>>
                                            <input class="form-control" name="ending_jumplink" title="链接地址" value="{$questionnaire['ending_jumplink']}" placeholder="链接地址">
                                        </div>
                                        <div class="div2" <if condition="($questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_OFF) or ($questionnaire.has_qrcode eq QuestionnaireModel::QRCODE_MISS)">style="display:none"</if>>
                                            <input type="hidden" name="ending_qrcode" value="{$questionnaire['ending_qrcode']}">
                                            <input type="file" onchange="uploadImage(this, [], [], 0, false, true);" class="end-upload" accept="image/gif,image/jpeg,image/jpg,image/png">
                                            <empty name="questionnaire.ending_qrcode">
                                                <img src="/Public/images/home/zbgyEcode.jpg" class="thumbnail" width="100" height="100">
                                                <else/>
                                                <img src="{$questionnaire['ending_qrcode']}" class="thumbnail" width="100" height="100">
                                            </empty>
                                            <p class="help-block">关注公众号的二维码</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="tab-pane" id="ending2">
                                <div class="form-group">
                                    <h4 class="end-h4">当测评结束后默认显示[不满足任何条件下显示]</h4>
                                    <h4 class="end-h4">
                                        [score]代表测试得分，如无需要显示分数可删除
                                        <a href="javascript:;" class="end-a-first" onclick="insertScore(this);">插入测试得分</a>
                                        <button type="button" class="btn btn-default end-button" onclick="showApplication(this);">添加应用</button>
                                        <button type="button" class="btn btn-default end-button" onclick="showEndingImage(this);">图片</button>
                                    </h4>
                                    <div class="col-lg-6">
                                        <div class="input-group m-bot15">
                                            <span class="input-group-addon">标题</span>
                                            <empty name="questionnaire_ending[0]['title']">
                                                <input class="form-control" name="title[]" value="Congratulations">
                                            <else/>
                                                <input class="form-control" name="title[]" value="{$questionnaire_ending[0]['title']}">
                                            </empty>
                                        </div>
                                        <textarea class="form-control end-textarea" rows="5" name="info[]"><empty name="questionnaire_ending">你的得分为[score]，邀请你的好友一起来测一测！<else/>{$questionnaire_ending[0]['info']}</empty></textarea>
                                    </div>
                                    <input type="hidden" name="lower_limit[]" value="0">
                                    <input type="hidden" name="upper_limit[]" value="0">
                                </div>
                                <div aria-hidden="true" aria-labelledby="myModalLabel1" role="dialog" tabindex="-1" id="modal1" class="modal fade">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">添加应用</h4>
                                            </div>
                                            <div class="modal-body">
                                                <div class="form-horizontal">
                                                    <div class="form-group">
                                                        <label class="col-lg-2 col-sm-2 control-label">活动标题</label>
                                                        <div class="col-lg-8">
                                                            <input class="form-control" name="activity_title[]" title="请输入活动标题" value="{$questionnaire_ending[0]['activity_title']}" placeholder="请输入活动标题">
                                                        </div>
                                                    </div>
                                                    <div class="form-group">
                                                        <label class="col-lg-2 col-sm-2 control-label">活动链接</label>
                                                        <div class="col-lg-8">
                                                            <input class="form-control" name="activity_url[]" title="请输入活动链接" value="{$questionnaire_ending[0]['activity_url']}" placeholder="请输入活动链接">
                                                        </div>
                                                    </div>
                                                    <!--<div class="form-group">-->
                                                        <!--<label class="col-lg-2 col-sm-2 control-label">活动二维码</label>-->
                                                        <!--<div class="col-lg-8">-->
                                                            <!--<input type="hidden" name="activity_image[]" value="{$questionnaire_ending[0]['activity_image']}">-->
                                                            <!--<input type="file" onchange="uploadImage([], [], 0, false, true);" class="activity-image" accept="image/gif,image/jpeg,image/jpg,image/png">-->
                                                            <!--<img src="{$questionnaire_ending[0]['activity_image']}" class="thumbnail" width="100" height="100">-->
                                                        <!--</div>-->
                                                    <!--</div>-->
                                                    <p class="help-block">*测试结束后的相关活动</p>
                                                </div>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" onclick="hideApplication();">提交</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div aria-hidden="true" aria-labelledby="picModalLabel1" role="dialog" tabindex="-1" id="pic-modal1" class="modal fade">
                                    <div class="modal-dialog">
                                        <div class="modal-content">
                                            <div class="modal-header">
                                                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                <h4 class="modal-title">图片</h4>
                                            </div>
                                            <div class="modal-body">
                                                <div class="form-horizontal">
                                                    <div class="form-group">
                                                        <label class="col-lg-2 col-sm-2 control-label">图片</label>
                                                        <div class="col-lg-8">
                                                            <input type="hidden" name="ending_image[]" value="{$questionnaire_ending[0]['ending_image']}">
                                                            <input type="file" onchange="uploadImage(this, ['png','jpg','jpeg','bmp','gif'], [680, 390], 500, true, true);" class="activity-image" accept="image/gif,image/jpeg,image/jpg,image/png">
                                                            <empty name="questionnaire_ending[0]['ending_image']">
                                                                <img src="/Public/images/questionnaire/reward.gif" class="thumbnail" width="100" height="100">
                                                            <else/>
                                                                <img src="{$questionnaire_ending[0]['ending_image']}" class="thumbnail" width="100" height="100">
                                                            </empty>
                                                        </div>
                                                    </div>
                                                    <p class="help-block">*有默认的图片，可自定义替换，图片为680px*390px的png、jpg、jpeg、bmp、gif格式图片格式图片，大小不超过500k</p>
                                                </div>
                                            </div>
                                            <div class="modal-footer">
                                                <button type="button" class="btn btn-info" onclick="hideApplication();">提交</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <volist name="questionnaire_ending" id="ending" offset="1">
                                    <div class="form-group">
                                        <h4 class="end-h4">
                                            当得分在<input class="end-text" type="text" name="lower_limit[]" value="{$ending.lower_limit}">到<input class="end-text" type="text" name="upper_limit[]" value="{$ending.upper_limit}">时显示
                                            <a href="javascript:;" class="end-a" onclick="insertScore(this);">插入测试得分</a>
                                            <button type="button" class="btn btn-default end-button" onclick="showApplication(this);">添加应用</button>
                                            <button type="button" class="btn btn-default end-button" onclick="showEndingImage(this);">图片</button>
                                        </h4>
                                        <div class="col-lg-6">
                                            <div class="input-group m-bot15">
                                                <span class="input-group-addon">标题</span>
                                                <empty name="ending['title']">
                                                    <input class="form-control" name="title[]" value="Congratulations">
                                                <else/>
                                                    <input class="form-control" name="title[]" value="{$ending['title']}">
                                                </empty>
                                            </div>
                                            <textarea class="form-control end-textarea" rows="5" name="info[]"><empty name="ending">你的得分为[score]，邀请你的好友一起来测一测！<else/>{$ending['info']}</empty></textarea>
                                        </div>
                                    </div>
                                    <div aria-hidden="true" aria-labelledby="myModalLabel{$i+1}" role="dialog" tabindex="-1" id="modal{$i+1}" class="modal fade">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                    <h4 class="modal-title">添加应用</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-horizontal">
                                                        <div class="form-group">
                                                            <label class="col-lg-2 col-sm-2 control-label">活动标题</label>
                                                            <div class="col-lg-8">
                                                                <input class="form-control" name="activity_title[]" title="请输入活动标题" value="{$ending.activity_title}" placeholder="请输入活动标题">
                                                            </div>
                                                        </div>
                                                        <div class="form-group">
                                                            <label class="col-lg-2 col-sm-2 control-label">活动链接</label>
                                                            <div class="col-lg-8">
                                                                <input class="form-control" name="activity_url[]" title="请输入活动链接" value="{$ending.activity_url}" placeholder="请输入活动链接">
                                                            </div>
                                                        </div>
                                                        <!--<div class="form-group">-->
                                                            <!--<label class="col-lg-2 col-sm-2 control-label">活动二维码</label>-->
                                                            <!--<div class="col-lg-8">-->
                                                                <!--<input type="hidden" name="activity_image[]" value="{$ending.activity_image}">-->
                                                                <!--<input type="file" onchange="uploadImage([], [], 0, false, true);" class="activity-image" accept="image/gif,image/jpeg,image/jpg,image/png">-->
                                                                <!--<img src="{$ending.activity_image}" class="thumbnail" width="100" height="100">-->
                                                            <!--</div>-->
                                                        <!--</div>-->
                                                        <p class="help-block">*测试结束后的相关活动</p>
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-info" onclick="hideApplication();">提交</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div aria-hidden="true" aria-labelledby="picModalLabel{$i+1}" role="dialog" tabindex="-1" id="pic-modal{$i+1}" class="modal fade">
                                        <div class="modal-dialog">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                                                    <h4 class="modal-title">图片</h4>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="form-horizontal">
                                                        <div class="form-group">
                                                            <label class="col-lg-2 col-sm-2 control-label">图片</label>
                                                            <div class="col-lg-8">
                                                                <input type="hidden" name="ending_image[]" value="{$ending.ending_image}">
                                                                <input type="file" onchange="uploadImage(this, ['png','jpg','jpeg','bmp','gif'], [680, 390], 500, true, true);" class="activity-image" accept="image/gif,image/jpeg,image/jpg,image/png">
                                                                <empty name="ending.ending_image">
                                                                    <img src="/Public/images/questionnaire/reward.gif" class="thumbnail" width="100" height="100">
                                                                <else/>
                                                                    <img src="{$ending.ending_image}" class="thumbnail" width="100" height="100">
                                                                </empty>
                                                            </div>
                                                        </div>
                                                        <p class="help-block">*有默认的图片，可自定义替换，图片为680px*390px的png、jpg、jpeg、bmp、gif格式图片格式图片，大小不超过500k</p>
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-info" onclick="hideApplication();">提交</button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </volist>
                                <button type="button" class="btn btn-info end-add" onclick="addEnding();">添加结束语</button>
                            </div>
                        </div>
                        <button type="submit" class="btn btn-primary">提交</button>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/Public/js/common/check-upload-file.js"></script>
<script>
    $(function () {
        $('#myTab a:first').tab('show');//初始化显示哪个tab

        $('#myTab a').click(function (e) {
            e.preventDefault();//阻止a链接的跳转行为
            $(this).tab('show');//显示当前选中的链接及关联的content
        })
    })

    function statusQuestionnaire(id, status){
        if(status == "active"){
            if(!confirm('确认发布吗？')) return false;
        }else if(status == "pending"){
            if(!confirm('确认停用吗？')) return false;
        }else{
            if(!confirm('确认删除吗？')) return false;
        }
        $.ajax({
            data: {id: id, status: status},
            dataType: 'json',
            url: '/User/Questionnaire/statusQuestionnaire',
            type: 'get',
            success: function (res) {
                alert(res['info']);
                window.location.reload();
            }
        });
        return false;
    }

    function uploadImage(c, types, size, kb, isCheck, isImage){
        var img = c.files[0];
        var _this = $(c);
        var url = "/User/Questionnaire/uploadFile";
        checkFile(_this, img, types, size, kb, isCheck, isImage, url);
    }

    function insertScore(c){
        var txtArea = $(c).parent().next().find(".end-textarea")[0];
        var content = txtArea.value;
        var start = txtArea.selectionStart;
        if(start == 0){
            txtArea.value = content + "[score]";
        }else{
            txtArea.value = content.substring(0, txtArea.selectionStart) + "[score]" + content.substring(txtArea.selectionEnd, content.length);
        }
        var position = start + $(c).parent().next().find(".end-textarea").html().length;
        txtArea.setSelectionRange(position, position);
    }

    function showApplication(c){
        var id = $(c).parent().parent().next().attr("id");
        $("#"+id).modal('show');
    }

    function hideApplication() {
        $('.modal').modal('hide');
    }

    function showEndingImage(c){
        var id = $(c).parent().parent().next().next().attr("id");
        $("#"+id).modal('show');
    }

    function addEnding(){
        var length = $(".modal").length + 1;
        var types = "['png','jpg','jpeg','bmp','gif']";
        var html = "";
        html += '<div class="form-group">';
        html += '   <h4 class="end-h4">';
        html += '       当得分在<input class="end-text" type="text" name="lower_limit[]" value="">到<input class="end-text" type="text" name="upper_limit[]" value="">时显示';
        html += '       <a href="javascript:;" class="end-a" onclick="insertScore(this);">插入测试得分</a>';
        html += '       <button type="button" class="btn btn-default end-button" onclick="showApplication(this);">添加应用</button>';
        html += '       <button type="button" class="btn btn-default end-button" onclick="showEndingImage(this);">图片</button>';
        html += '   </h4>';
        html += '   <div class="col-lg-6">';
        html += '       <div class="input-group m-bot15">';
        html += '           <span class="input-group-addon">标题</span>';
        html += '           <input class="form-control" name="title[]" value="Congratulations">';
        html += '       </div>';
        html += '       <textarea class="form-control end-textarea" rows="5" name="info[]">你的得分为[score]，邀请你的好友一起来测一测！</textarea>';
        html += '   </div>';
        html += '</div>';
        html += '<div aria-hidden="true" aria-labelledby="myModalLabel'+length+'" role="dialog" tabindex="-1" id="modal'+length+'" class="modal fade">';
        html += '    <div class="modal-dialog">';
        html += '       <div class="modal-content">';
        html += '           <div class="modal-header">';
        html += '               <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>';
        html += '               <h4 class="modal-title">添加应用</h4>';
        html += '           </div>';
        html += '           <div class="modal-body">';
        html += '               <div class="form-horizontal">';
        html += '                   <div class="form-group">';
        html += '                       <label class="col-lg-2 col-sm-2 control-label">活动标题</label>';
        html += '                       <div class="col-lg-8">';
        html += '                           <input class="form-control" name="activity_title[]" title="请输入活动标题" value="" placeholder="请输入活动标题">';
        html += '                       </div>';
        html += '                   </div>';
        html += '                   <div class="form-group">';
        html += '                       <label class="col-lg-2 col-sm-2 control-label">活动链接</label>';
        html += '                       <div class="col-lg-8">';
        html += '                           <input class="form-control" name="activity_url[]" title="请输入活动链接" value="" placeholder="请输入活动链接">';
        html += '                       </div>';
        html += '                   </div>';
//        html += '                   <div class="form-group">';
//        html += '                       <label class="col-lg-2 col-sm-2 control-label">活动二维码</label>';
//        html += '                       <div class="col-lg-8">';
//        html += '                           <input type="hidden" name="activity_image[]" value="">';
//        html += '                           <input type="file" onchange="uploadImage([], [], 0, false, true);" class="activity-image" accept="image/gif,image/jpeg,image/jpg,image/png">';
//        html += '                           <img src="" class="thumbnail" width="100" height="100">';
//        html += '                       </div>';
//        html += '                   </div>';
        html += '                   <p class="help-block">*测试结束后的相关活动</p>';
        html += '               </div>';
        html += '           </div>';
        html += '           <div class="modal-footer">';
        html += '               <button type="button" class="btn btn-info" onclick="hideApplication();">提交</button>';
        html += '           </div>';
        html += '       </div>';
        html += '    </div>';
        html += '</div>';
        html += '<div aria-hidden="true" aria-labelledby="picModalLabel'+length+'" role="dialog" tabindex="-1" id="pic-modal'+length+'" class="modal fade">';
        html += '    <div class="modal-dialog">';
        html += '       <div class="modal-content">';
        html += '           <div class="modal-header">';
        html += '               <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>';
        html += '               <h4 class="modal-title">图片</h4>';
        html += '           </div>';
        html += '           <div class="modal-body">';
        html += '               <div class="form-horizontal">';
        html += '                   <div class="form-group">';
        html += '                       <label class="col-lg-2 col-sm-2 control-label">图片</label>';
        html += '                       <div class="col-lg-8">';
        html += '                           <input type="hidden" name="ending_image[]" value="">';
        html += '                           <input type="file" onchange="uploadImage(this, '+types+', [680, 390], 500, true, true);" class="activity-image" accept="image/gif,image/jpeg,image/jpg,image/png">';
        html += '                           <img src="/Public/images/questionnaire/reward.gif" class="thumbnail" width="100" height="100">';
        html += '                       </div>';
        html += '                   </div>';
        html += '                   <p class="help-block">*有默认的图片，可自定义替换，图片为680px*390px的png、jpg、jpeg、bmp、gif格式图片格式图片，大小不超过500k</p>';
        html += '               </div>';
        html += '           </div>';
        html += '           <div class="modal-footer">';
        html += '               <button type="button" class="btn btn-info" onclick="hideApplication();">提交</button>';
        html += '           </div>';
        html += '       </div>';
        html += '    </div>';
        html += '</div>';
        $(".end-add").before(html);
    }
</script>